<!--这个组件就是用来加载控制选项的-->
<template>
  <div class="tab-control">
      <div v-for="(item,index) in titles" class="tab-control-item" @click="actives(index)" :class="{active:currentindex === index}">
          <span>{{item}}</span>
      </div>  
  </div>
</template>

<script>
export default {
  name: "tabcontrol",
  data() {
    return {
        currentindex:0
    };
  },props:{
      titles:{
          type:Array,
          default:[]
      }
  },methods: {
      actives(index){
          //console.log(index)
          //console.log(this.currentindex)
          this.currentindex=index
          this.$emit('homeclick',index);
      }
  },
};
</script>

<style scoped>
.tab-control{
    display: flex;
    text-align: center;
    font-size: 15px;
    height: 40px;
    line-height: 40px;
    background-color: #fff;
    z-index:9;
}
.tab-control-item{
    flex: 1;
    

}
.tab-control-item span{
    padding: 5px;
    font-size: 18px;

}
.active{
    color: var(--color-high-text);

}
.active span{
border-bottom: 3px solid var(--color-tint);
}
</style>